package dao

import (
	"advertising/internal/dal"
	"advertising/internal/models"
	"context"
	"time"

	"192.168.1.75/go-pkg/helper"
	"gorm.io/gorm"
)

type PublishScheduleAuditLog struct{}

func (PublishScheduleAuditLog) Create(ctx context.Context, db *gorm.DB, merchantID, merchantName, scheduleID, auditMerchantID, auditMerchantName, auditUser, auditUsername string, auditStatus int) (err error) {
	m := dal.Use(db).PublishScheduleAuditLog
	var d models.PublishScheduleAuditLog
	d.ID, _ = helper.UUID{}.String()
	d.MerchantID = merchantID
	d.MerchantName = merchantName
	d.ScheduleID = scheduleID
	d.AuditMerchantID = auditMerchantID
	d.AuditMerchantName = auditMerchantName
	d.AuditUser = auditUser
	d.AuditUsername = auditUsername
	d.AuditStatus = auditStatus // 1 通过, 2拒绝
	d.AuditAt = time.Now().Unix()
	m.WithContext(ctx).Create(&d)
	return nil
}
